package h0907;
/**
  * @description 爬楼梯
  * @author 不知名帅哥
  * @date 2024/9/7 23:19
  * @version 1.0
*/
public class ClimbStairs {
    public static void main(String[] args) {

    }
    public int climbStairs(int n) {
        int[] dp = new int[n+1];
        dp[0]=1;
        dp[1]=1;
        if (n==1) return 1;
        dp[2]=dp[0]+dp[1];
        for (int i = 3; i <= n; i++) {
            dp[i]=dp[i-1]+dp[i-2];
        }
        return dp[n];
    }
}
